export const state = () => ({
  isLogin: false,
})
export const mutations = {
  setLogin (state, payload) {
    state.isLogin = payload
  }
}
export const actions = {
  async nuxtServerInit ({ commit }, { app, redirect }) {
    const { $cookies } = app
    const token = $cookies.get('access_token')
    // 如果token 存在 则表示已登入
    if (token) {
      commit('setLogin',true)
    } else {
      commit('setLogin',false)
    }
  }
}
